package com.go.where.family.service.impl;

import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.go.where.family.constants.Constant;
import com.go.where.family.dao.OrderDao;
import com.go.where.family.pojo.OrderInfo;
import com.go.where.family.service.OrderService;

@Service("orderService")
public class OrderServiceImpl implements OrderService {

	@Resource(name = "orderDao")
	private OrderDao orderDao;

	@Override
	public List<OrderInfo> queryList(Map<String, Object> map) {
		return orderDao.queryT(map);
	}

	@Override
	public OrderInfo queryOrderDetail(String orderId) {
		OrderInfo oi = new OrderInfo();
		oi.setOrderId(orderId);
		return orderDao.queryByPrimaryKey(oi);
	}

	@Override
	public int save(OrderInfo orderInfo) {
		orderInfo.setOrderTime(new Date());
		orderInfo.setIsDelete(Constant.IS_NOT_DELETE);
		return orderDao.insert(orderInfo);
	}

	@Override
	public int update(OrderInfo orderInfo) {
		orderInfo.setUpdateTime(new Date());
		return orderDao.update(orderInfo);
	}

	@Override
	public Integer sumPersonNum(Map<String, Object> map) {
		return orderDao.sumPersonNum(map);
	}

}
